﻿using System;
using System.Linq;
using System.Web.UI;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing.WebControls;

namespace Eneta.Portal.Controls
{
    public class MasterPageBase : MasterPage
    {
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Control c;
            var isAdmin = false;

            var user = SPContext.Current.Web.CurrentUser;
            if(user != null)
                isAdmin = user.IsSiteAdmin;
            
            c = FindControl("PubCtls");
            if (c != null)
                c.Visible = isAdmin;
        }         
    }
}
